import http from "../utils/http"

class Service {
  /**
   * 
   * @param {*} page 页码 
   * @param {*} count 每页数量
   * @param {*} category_id  分类ID
   * @param {*} type  服务类型
   */
  page = 1
  count = 4
  data = []
  hasMoreData = []
  async getServiceList(page, count, category_id = null, type = null) {
    const serviceList = await  http.request({
      url: 'v1/service/list',
      data: {
        page:this.page,
        count:this.count,
        category_id: category_id || '',
        type: type || ''
      }
    })
    this.data = this.data.concat(serviceList.data)
    console.log(this.data)
    this.hasMoreData = !(this.page===serviceList.last_page)
    this.page++
    return this.data
  }
}  
export default Service